using UnityEngine;
using System.Collections;

public class PlayerShooting : MonoBehaviour 
{
	public GameObject playerProjectile;
	public float timeBetweenShots = 0.2f;
	
	private float _nextShot = 0.0f;
	
	private Transform _transform;
	
	void Start()
	{
		_transform = transform;
	}
	// Update is called once per frame
	void Update () 
	{
		if(Input.GetButtonDown("Fire") && Time.time > _nextShot)
		{
			_nextShot = Time.time + timeBetweenShots;
			Instantiate(playerProjectile, _transform.position, Quaternion.identity);
		}
	}
}
